﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MangaRipper.Properties;

namespace MangaRipper
{
    public partial class FormOption : Form
    {
        public FormOption()
        {
            InitializeComponent();
        }

        private void FormOption_Load(object sender, EventArgs e)
        {
            switch (Settings.Default.SaveMethod)
            {
                case "Default":
                    saveMethodChooser.SelectedIndex = 0;
                    break;
                case "CBZ":
                    saveMethodChooser.SelectedIndex = 1;
                    //cbcCheckbox.Visible = Visible;
                    if (Settings.Default.doCBC) cbcCheckbox.Checked = true;
                    else cbcCheckbox.Checked = false;
                    break;
                case "PDF":
                    saveMethodChooser.SelectedIndex = 2;
                    break;
            }
        }

        private void cbcCheckbox_CheckedChanged(object sender, EventArgs e)
        {
            if(cbcCheckbox.Checked) Settings.Default.doCBC = true;
            else Settings.Default.doCBC = false;
        }

        private void saveMethodChooser_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (saveMethodChooser.SelectedIndex)
            {
                case 0:
                    Settings.Default.SaveMethod = "Default";
                    //if (cbcCheckbox.Visible) cbcCheckbox.Visible = false;
                    break;
                case 1:
                    Settings.Default.SaveMethod = "CBZ";
                    //if (!cbcCheckbox.Visible) cbcCheckbox.Visible = true;
                    break;
                case 2:
                    Settings.Default.SaveMethod = "PDF";
                    //if (cbcCheckbox.Visible) cbcCheckbox.Visible = false;
                    break;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }    
    }
}
